/**
 * ProductModel
 * @Chunning.Xu
 * 2011 Nov 22, 2011 3:21:17 PM
 **/
package com.lux.product.models
{
	import flash.display.BitmapData;
	import flash.utils.getDefinitionByName;

	public class ProductModel extends GeneralModel
	{
		//START.
		
		public var title:String;
		public var label:String;
		public var des:String;
		public var tip:String;
		public var share:String;
		
		public var purchase:String;
		public var tracking:TrackingModel;
		
		public var image:BitmapData;
		
		public function ProductModel()
		{
		}
		
		public override function setXML(xml:XML):void
		{
			this.xml = xml;
			
			this.share = xml["share"];
			this.title = xml["@title"];
			this.label = xml["@label"];
			this.des = xml["des"].toString();
			this.tip = xml["tip"].toString();
			this.image = (new (getDefinitionByName(this.label) as Class)) as BitmapData;
			
			if(xml.hasOwnProperty("purchase") && xml["purchase"].toString().length > 0)
				purchase = xml["purchase"].toString();	
			
			tracking = new TrackingModel;
			tracking.setXML(xml["tracking"][0]);
		}
		
		//END
	}
}